/*
 * @Description: 
 * @Author: SunShRui
 * @Date: 2021-01-21 00:01:37
 * @LastEditors: SunShRui
 * @LastEditTime: 2021-01-21 00:11:57
 * @FilePath: /flutter_hk_advertisement/lib/src/DataUtil.dart
 */
import 'dart:io';

import 'package:dio/dio.dart';

class DataUtil {
  ///获取增值服务数据
  static Future<String> getAddServiceData(
      {String appName, String position, String version}) async {
    String platform = Platform.isAndroid ? 'Android' : 'iOS';
    String requestBaseUrl = 'http://119.61.26.55:8140/p4-ref-pt/';
    String requestUrl = 'getServiceListForApp?';
    Dio dio = new Dio();
    dio.options.baseUrl = requestBaseUrl;
    FormData formData = new FormData.fromMap({
      'appName': appName,
      'position': position,
      'version': version,
      'platform': platform,
    });
    Response response = await dio.post(requestUrl, data: formData);
    print('获取增值服务数据');
    print('当前appName:' + appName);
    print('当前app版本:' + version);
    print('当前平台:' + platform);
    print('当前postion:' + position);
    print('增值服务返回数据：' + response.data.toString());
    return response.data.toString();
  }
}
